<div class="grid_9">
<?php if($this->session->flashdata('type')): ?>
	<div class="<?php echo $this->session->flashdata('type')?>"><?php echo $this->session->flashdata('msg')?></div>
<?php endif; ?>
<div class="inner-border">
<h6>Search students</h6>
<? $formAttrib 		= array('id' => 'searchstudent', 'class' => 'admin-form');
   $FnameAttrib 	= array('name' => 'firstname', 'value' => '', 'id' => 'username');
   $LnameAttrib 	= array('name' => 'lastname', 'value' => '', 'id' => 'password');
   $MnameAttrib 	= array('name' => 'middlename', 'value' => '', 'id' => 'password');
   $UseridAttrib 	= array('name' => 'id_no', 'value' => '', 'id' => 'password');
   $CourseAttrib 	= array('name' => 'course_id', 'value' => '', 'id' => 'password');
	
?>
<?=form_open('post/search_student', $formAttrib);?>
		<div class="input-block">
			<?php
				echo form_label('Firstname :', 'firstname');
				echo form_input($FnameAttrib);		
			?>
		</div>
		
		<div class="input-block">
			<?php
				echo form_label('Lastname :', 'Lastname');
				echo form_input($LnameAttrib);		
			?>
		</div>
		<div class="input-block">
			<?php
				echo form_label('Middlename :', 'middlename');
				echo form_input($MnameAttrib);		
			?>
		</div>
		
		<div class="input-block">
			<?php
				echo form_label('Id Number:', 'idnumber');
				echo form_input($UseridAttrib);		
			?>
		</div>
		<div class="input-block">
			<?echo form_label('Course:', 'course');?>
			<? if(!empty($course_menu)):?>
				<select name="course_id">
					<option value="">-- choose course --</option>
					<?foreach($course_menu as $course):?>
						<option value="<?=$course->course_id;?>"><?=$course->course_name;?></option>
					<?endforeach;?>
				</select>
		</div>
			<?else:?>
				<div class="error">Unable to retrieve course data</div>
			<?endif;?>

		
		<div class="input-block">
			<input type="submit" value="search">
		</div>
		</form>	
</div>		
<? if(empty($db_entries)):?>
		<div class="notice">No data to show</div>
<? else:?>
<div class="inner-border">
	<h6>(<?=count($db_entries);?>) entries found</h6>
		<table>
			<tr>
				<th>Firstname</th>
				<th>middlename</th>
				<th>lastnamename</th>
				<th>Actions</th>
			</tr>
			<tbody class="tabular">
			<? foreach($db_entries as $row):?>
					<tr><td><?=$row->firstname;?></td>
						<td><?=$row->lastname;?></td>
						<td><?=$row->middlename;?></td>
						<td style="width:125px;">
							<a href="<?=site_url('admin/update_student_data').'/'.$row->user_id;?>" class="btn">show profile</a>
						</td>
					</tr>
			<? endforeach;?>
			</tbody>
		</table>
</div>
<? endif;?>
</div>
</div>